//
//  UIViewNav.m
//  TianHeCRD
//
//  Created by David on 12-11-20.
//  Copyright (c) 2012年 VeryApps. All rights reserved.
//

#import "UIViewNav.h"

@implementation UIViewNav

@synthesize labelTitle = _labelTitle;
@synthesize btnBack = _btnBack;
@synthesize btnRight = _btnRight;


- (id)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        CGRect rc = self.bounds;
        rc.origin.x = 10;
        rc.size.width = 46;
        rc.size.height = 24;
        rc.origin.y = floorf((self.bounds.size.height-rc.size.height)/2);
        _btnBack = [[UIButton alloc] initWithFrame:rc];
        [self addSubview:_btnBack];
        
        rc.origin.x = self.bounds.size.width-rc.size.width-_btnBack.frame.origin.x;
        _btnRight = [[UIButton alloc] initWithFrame:rc];
        [self addSubview:_btnRight];
        
        rc.origin.x = _btnBack.frame.origin.x+_btnBack.bounds.size.width+10;
        rc.size.width = _btnRight.frame.origin.x-rc.origin.x-10;
        _labelTitle = [[UILabel alloc] initWithFrame:rc];
        _labelTitle.backgroundColor = [UIColor clearColor];
        _labelTitle.font = [UIFont boldSystemFontOfSize:18];
        _labelTitle.textColor = [UIColor whiteColor];
        _labelTitle.textAlignment = NSTextAlignmentCenter;
        [self addSubview:_labelTitle];
        
        self.backgroundColor = [UIColor colorWithRed:48.0/255.0 green:149/255.0 blue:199.0/255.0 alpha:1];
    }
    return self;
}

- (void)awakeFromNib {
    self.backgroundColor = [UIColor colorWithRed:48.0/255.0 green:149/255.0 blue:199.0/255.0 alpha:1];
}

@end
